﻿<cfsilent>
	<cfscript>
		
		stringAdvice = getProperty("serviceFactory").getBean("stringAdvice");
		
		event.setArg("pageTitle", "教学质量评价 - 评价指标体系设置向导");
		
		currentTab = event.getArg("TabID", "labPreview");
		
		evsId = event.getArg("ES");
		
		passArgs = structNew();
		structInsert( passArgs, "ES", evsId );
		
		/* 评价体系相关设置 */
		sql = "SELECT 
				es_name, es_model, es_level 
				FROM t_evaluate_system 
				WHERE 
					es_id = :evsId ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="evsId", value=evsId, cfsqltype="cf_sql_char" );

		rs_evs = queryObj.execute( sql=sql ).getResult();
		
		
		/* 评价体系观测点 */
		sql = "SELECT 
				level_order, tag_id, tag_order, tag_weight, question, m_id 
				FROM t_target 
				WHERE 
					es_id = :evsId 
				ORDER BY level_order, tag_order";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="evsId", value=evsId, cfsqltype="cf_sql_char" );
		
		rs_target = queryObj.execute( sql=sql ).getResult();
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('evaluateSystem')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">评价指标体系</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i>评价指标体系设置向导
				</h2>
			</div>
		</div>
	</div>
</div>

<!--- 加载导航菜单 --->
<!-- stepMenu-->
<cfoutput>#event.getArg("stepMenu")#</cfoutput>
<!--/stepMenu-->

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labPreview">class="active"</cfif> id="labPreview" tabTarget="Preview">问卷预览</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>				
				</script>
				
				<div id="Preview" class="tabContent">
					
					<div class="noticeBlock">
						<div class="operation">
							<a class="uiButton" href="<cfoutput>#buildURL('evaluateSystemSetupWizardQuestion', passArgs)#</cfoutput>"><i class="mrs img btnExecute"></i><span class="uiButtonText">修改题目</span></a>
							<a class="uiButton" href="<cfoutput>#buildURL('evaluateSystemSetupWizardCourse', passArgs)#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">关联课程</span></a>
						</div>
						<h3><cfoutput>#rs_evs.es_name#</cfoutput></h3>
						<hr/>
					</div>
					
					<!--- 两段式评教 --->
					<cfif rs_evs.es_model eq "M2">
						
						<table class="UItable">
							<cfloop from="1" to="2" index="stageId">

								<cfscript>
							
									sql = "SELECT tag_order, question, tag_weight FROM query 
											WHERE level_order = :stageId AND tag_order LIKE '__00' ";
							
									queryObj = new Query( dbtype="query" );
									queryObj.setAttributes( query=rs_target );
									queryObj.addParam( name="stageId", value=stageId, cfsqltype="cf_sql_char" );

									rs_type = queryObj.execute( sql=sql ).getResult();

								</cfscript>
								
								<cfif rs_type.recordCount>
									<cfif stageId gt 1>
										<tr class="breakRows">
											<td colspan="3"></td>
										</tr>
									</cfif>
									<tr class="cellBorder cellHeader">
										<td colspan="3">
										<cfif stageId eq 1>
											课程进行期间
											<cfelse>
											课程结束后
										</cfif>
										</td>
									</tr>
									<tr class="breakRows">
										<td colspan="3"></td>
									</tr>
								</cfif>
								
								<cfloop query="rs_type">
									
									<tr class="cellBorder cellNotice">
										<td><cfoutput>#rs_type.question#</cfoutput> <span class="numeric"><cfoutput>#rs_type.tag_weight#</cfoutput> Point</span></td>
										<td width="25">权重</td>
										<td width="220">观察点选项</td>
									</tr>
									
									<cfscript>
									
										sql = "SELECT tag_id, question, tag_weight, m_id FROM query 
												WHERE level_order = :stageId AND tag_order NOT LIKE '__00' AND tag_order LIKE :condition ";
							
										queryObj = new Query( dbtype="query" );
										queryObj.setAttributes( query=rs_target );
										queryObj.addParam( name="stageId", value=stageId, cfsqltype="cf_sql_char" );
										queryObj.addParam( name="condition", value=left(rs_type.tag_order, 2) & "__", cfsqltype="cf_sql_char" );

										rs_list = queryObj.execute( sql=sql ).getResult();
										
									</cfscript>
									
									<cfif rs_list.recordCount>

										<cfloop query="rs_list">
										
											<cfscript>
												
												measureId = rs_list.m_id;
												
												sql = "SELECT opt_name FROM t_measure_options WHERE m_id = :measureId ORDER BY opt_idx";
												
												queryObj = new Query( datasource=application.dnsSlave );
												queryObj.addParam( name="measureId", value=measureId, cfsqltype="cf_sql_char" );
		
												rs_opt = queryObj.execute( sql=sql ).getResult();
												
											</cfscript>

											<tr class="cellBorder">
												<td><cfoutput>#stringAdvice.XHTMLSafeFormat( rs_list.question )#</cfoutput></td>
												<td align="center"><span class="numeric"><cfoutput>#rs_list.tag_weight#</cfoutput></span></td>
												<td>
													<cfset row = 0 />
													<cfloop query="rs_opt">
														<cfset row++ />
														<span class="stat <cfif row eq 1>on<cfelse>off</cfif>"></span><cfoutput>#rs_opt.opt_name#</cfoutput>
													</cfloop>
												</td>
											</tr>
											
										</cfloop>
										
									</cfif>
									
								</cfloop>
								
							</cfloop>
						</table>
						
					</cfif>
					
					<!--- 三阶段评教 --->
					<cfif rs_evs.es_model eq "M3">
						
						<table class="UItable">
							<cfloop from="1" to="3" index="stageId">

								<cfscript>
							
									sql = "SELECT tag_order, question, tag_weight FROM query 
											WHERE level_order = :stageId AND tag_order LIKE '__00' ";
							
									queryObj = new Query( dbtype="query" );
									queryObj.setAttributes( query=rs_target );
									queryObj.addParam( name="stageId", value=stageId, cfsqltype="cf_sql_char" );

									rs_type = queryObj.execute( sql=sql ).getResult();

								</cfscript>
								
								<cfif rs_type.recordCount>
									<cfif stageId gt 1>
										<tr class="breakRows">
											<td colspan="3"></td>
										</tr>
									</cfif>
									<tr class="cellBorder cellHeader">
										<td colspan="3">第<cfoutput>#stringAdvice.ChineseNumber(stageId)#</cfoutput>阶段</td>
									</tr>
									<tr class="breakRows">
										<td colspan="3"></td>
									</tr>
								</cfif>
								
								<cfloop query="rs_type">
									
									<tr class="cellBorder">
										<td><cfoutput>#rs_type.question#</cfoutput> <span class="numeric"><cfoutput>#rs_type.tag_weight#</cfoutput> Point</span></td>
										<td width="25">权重</td>
										<td width="250">观察点选项</td>
									</tr>
									
									<cfscript>
									
										sql = "SELECT tag_id, question, tag_weight, m_id FROM query 
												WHERE level_order = :stageId AND tag_order NOT LIKE '__00' AND tag_order LIKE :condition ";
							
										queryObj = new Query( dbtype="query" );
										queryObj.setAttributes( query=rs_target );
										queryObj.addParam( name="stageId", value=stageId, cfsqltype="cf_sql_char" );
										queryObj.addParam( name="condition", value=left(rs_type.tag_order, 2) & "__", cfsqltype="cf_sql_char" );

										rs_list = queryObj.execute( sql=sql ).getResult();
										
									</cfscript>
									
									<cfif rs_list.recordCount>

										<cfloop query="rs_list">
										
											<cfscript>
												
												measureId = rs_list.m_id;
												
												sql = "SELECT opt_name FROM t_measure_options WHERE m_id = :measureId ORDER BY opt_idx";
												
												queryObj = new Query( datasource=application.dnsSlave );
												queryObj.addParam( name="measureId", value=measureId, cfsqltype="cf_sql_char" );
		
												rs_opt = queryObj.execute( sql=sql ).getResult();
												
											</cfscript>

											<tr class="cellBorder">
												<td><cfoutput>#stringAdvice.XHTMLSafeFormat( rs_list.question )#</cfoutput></td>
												<td align="center"><span class="numeric"><cfoutput>#rs_list.tag_weight#</cfoutput></span></td>
												<td>
													<cfset row = 0 />
													<cfloop query="rs_opt">
														<cfset row++ />
														<span class="stat <cfif row eq 1>on<cfelse>off</cfif>"></span> <cfoutput>#rs_opt.opt_name#</cfoutput>
													</cfloop>
												</td>
											</tr>
											
										</cfloop>
										
									</cfif>
									
								</cfloop>
								
							</cfloop>
						</table>
						
					</cfif>

				</div>
			
			</div>
		</li>
	</ul>
</div>
					

